package com.zc.im.mapper.im.group;

import com.zc.im.model.im.group.ZcImMsgHistoryModel;
import com.zc.im.model.im.group.ZcImMsgHistoryExample;
import com.zc.im.model.im.group.ZcImMsgHistoryKey;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface ZcImMsgHistoryMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_msg_history
     *
     * @mbggenerated
     */
    int countByExample(ZcImMsgHistoryExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_msg_history
     *
     * @mbggenerated
     */
    int deleteByExample(ZcImMsgHistoryExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_msg_history
     *
     * @mbggenerated
     */
    @Delete({
        "delete from zc_im_msg_history",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(ZcImMsgHistoryKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_msg_history
     *
     * @mbggenerated
     */
    @Insert({
        "insert into zc_im_msg_history (id, content, ",
        "msg_agreement_type, msg_type, ",
        "source_obj_id, target_obj_id, ",
        "source_obj_type, target_obj_type, ",
        "created_time, updated_time, ",
        "company_id, msg_read_status, ",
        "status)",
        "values (#{id,jdbcType=INTEGER}, #{content,jdbcType=VARCHAR}, ",
        "#{msgAgreementType,jdbcType=VARCHAR}, #{msgType,jdbcType=VARCHAR}, ",
        "#{sourceObjId,jdbcType=INTEGER}, #{targetObjId,jdbcType=INTEGER}, ",
        "#{sourceObjType,jdbcType=VARCHAR}, #{targetObjType,jdbcType=VARCHAR}, ",
        "#{createdTime,jdbcType=TIMESTAMP}, #{updatedTime,jdbcType=TIMESTAMP}, ",
        "#{companyId,jdbcType=INTEGER}, #{msgReadStatus,jdbcType=VARCHAR}, ",
        "#{status,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=true, resultType=Integer.class)
    int insert(ZcImMsgHistoryModel record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_msg_history
     *
     * @mbggenerated
     */
    int insertSelective(ZcImMsgHistoryModel record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_msg_history
     *
     * @mbggenerated
     */
    List<ZcImMsgHistoryModel> selectByExample(ZcImMsgHistoryExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_msg_history
     *
     * @mbggenerated
     */
    @Select({
        "select",
        "id, content, msg_agreement_type, msg_type, source_obj_id, target_obj_id, source_obj_type, ",
        "target_obj_type, created_time, updated_time, company_id, msg_read_status, status",
        "from zc_im_msg_history",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    ZcImMsgHistoryModel selectByPrimaryKey(ZcImMsgHistoryKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_msg_history
     *
     * @mbggenerated
     */
    int updateByExampleSelective(@Param("record") ZcImMsgHistoryModel record, @Param("example") ZcImMsgHistoryExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_msg_history
     *
     * @mbggenerated
     */
    int updateByExample(@Param("record") ZcImMsgHistoryModel record, @Param("example") ZcImMsgHistoryExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_msg_history
     *
     * @mbggenerated
     */
    int updateByPrimaryKeySelective(ZcImMsgHistoryModel record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_msg_history
     *
     * @mbggenerated
     */
    @Update({
        "update zc_im_msg_history",
        "set content = #{content,jdbcType=VARCHAR},",
          "msg_agreement_type = #{msgAgreementType,jdbcType=VARCHAR},",
          "msg_type = #{msgType,jdbcType=VARCHAR},",
          "source_obj_id = #{sourceObjId,jdbcType=INTEGER},",
          "target_obj_id = #{targetObjId,jdbcType=INTEGER},",
          "source_obj_type = #{sourceObjType,jdbcType=VARCHAR},",
          "target_obj_type = #{targetObjType,jdbcType=VARCHAR},",
          "created_time = #{createdTime,jdbcType=TIMESTAMP},",
          "updated_time = #{updatedTime,jdbcType=TIMESTAMP},",
          "company_id = #{companyId,jdbcType=INTEGER},",
          "msg_read_status = #{msgReadStatus,jdbcType=VARCHAR},",
          "status = #{status,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ZcImMsgHistoryModel record);


    List<ZcImMsgHistoryModel> selectMsgOrByExample(ZcImMsgHistoryModel msgHistoryModel);
}